<html>
    <head>
        <script type="text/javascript" src="js/prototype-1.6.0.2.js"></script>
        <script> 
var Notifier = Class.create({
    initialize:function(url){
        this.layers= [];
    },
    getLayerCnt:function(){
        return this.layers.size();
    },
    createLayer: function(content, pos_top, pos_left){
        var div = $(document.createElement('div'));
        div.setStyle({
          position: 'absolute',
          top: pos_top,
          left: pos_left,
          'z-index': (800 + this.getLayerCnt()).toString()
        });
        div.innerHTML = content;
        return div;
    },
    getBodyInner:function(htmlContent){
        return htmlContent.gsub(/[\r\n|\n]/,'').match(/<body>.*<\/body>/).toString().gsub(/<body>|<\/body>/,'');
    },
    getLayerTop:function(){
        return ((this.getLayerCnt()+1)*50) + (screen.width/2) - 500;
    },
    getLayerLeft:function(){
        return ((this.getLayerCnt()+1)*80) + (screen.height/2) - 260;
    },
    showLayer:function(url){
        var response;
        new Ajax.Request(url, {method:'get', asynchronous:false, onSuccess:function(transport){
                response = transport.responseText;
        }});

        var bodyInner = this.getBodyInner(response);
        var layer = this.createLayer(bodyInner, this.getLayerTop(), this.getLayerLeft());
        this.layers[this.layers.size()] = layer;
        document.body.appendChild(layer);
        this.registerMapAreaEvent(layer);
    },
    registerMapAreaEvent:function(layer){
        var mapTagEle = [];
        $(layer).childElements().each(function(item){
            if(item.tagName == "MAP") mapTagEle[mapTagEle.size()] = item;
        });

        var layerCnt = this.getLayerCnt();
        mapTagEle[0].childElements().each(function(item){
            var handler = '';
            switch(item.id){
                case "AR_CLOSE":
                    handler = "notifier.hide("+ layerCnt +")";
                break;
                case "AR_TODAYCLOSE":
                    handler = "notifier.hide("+ layerCnt +")";
                break;
                case "AR_GOTO":
                    handler = "notifier.go('"+ item.href +"')";
                break;
            }
            item.href = "javascript:" + handler;
        });
    },
    showPopup:function(url, width, height){
        var styleTemplate = new Template('width=#{width},height=#{height},scrollbars=no,top=0,left=0'); 
        var style = {'width': width, 'height': height}; 
        window.open(url,'____', styleTemplate.evaluate(style));
    },
    hide:function(index){
        $(this.layers[index-1]).hide();
    },
    go:function(url){
        document.location = url;
    }
});

var notifier = new Notifier();
Event.observe(window, 'load', loadComplete);
function loadComplete(){
    var url = "http://www.thetravel.co.kr/lts/template_interpark/wholesale/company_contact.html";
    var url2 = 'http://air.interpark.com/html/popup/security1.html';
    notifier.showLayer(url2); 
    notifier.showPopup(url2); 
}
        </script> 
    </head>
    <body>
            <input type="text" id="comablade" value="Hard Coded String" />
            alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj alskdfjalkdfjsalksdfjalsdkfj 
    </body>
</html>
